﻿<UserControl x:Class="SIEGate.UI.UserControls.SubscriberRequestUserControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" d:DesignHeight="650" d:DesignWidth="850"
             xmlns:vm="clr-namespace:SIEGate.UI.ViewModels"
             Background="Transparent">

    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/GSF.TimeSeries.UI.WPF;Component/Resources/CommonResource.xaml" />
            </ResourceDictionary.MergedDictionaries>
            
            <vm:SubscriberRequestViewModel x:Key="ViewModel" />
        </ResourceDictionary>
    </UserControl.Resources>

    <StackPanel Orientation="Vertical" HorizontalAlignment="Center" DataContext="{StaticResource ViewModel}">
        <GroupBox Header="Publisher Info">
            <Grid HorizontalAlignment="Center">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                
                <Label Grid.Row="0" Grid.Column="0" Content="Acronym" />
                <TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Mode=TwoWay, Path=Acronym}" CharacterCasing="Upper" />
                <Label Grid.Row="0" Grid.Column="2" Content="Name" />
                <TextBox Grid.Row="0" Grid.Column="3" Text="{Binding Mode=TwoWay, Path=Name}" />

                <Label Grid.Row="1" Grid.Column="0" Content="Hostname" />
                <TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Mode=TwoWay, Path=Hostname}" />
                <Label Grid.Row="1" Grid.Column="2" Content="Port" />
                <TextBox Grid.Row="1" Grid.Column="3" Width="{StaticResource XXSmallItemSize}" Text="{Binding Mode=TwoWay, Path=Port}" />
            </Grid>
        </GroupBox>
        
        <GroupBox Header="TLS">
            <Grid HorizontalAlignment="Center">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>

                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>

                <Label Grid.Row="0" Grid.Column="0" Content="Local certificate" />
                <StackPanel Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="3" Orientation="Horizontal">
                    <TextBox Width="{StaticResource XXLargeItemSize}" Text="{Binding Mode=TwoWay, Path=LocalCertificateFile}" />
                    <Button Height="25" Content="Browse..." Command="{Binding LocalBrowseCommand}" />
                </StackPanel>
                    
                <Label Grid.Row="1" Grid.Column="0" Content="Remote certificate" />
                <StackPanel Grid.Row="1" Grid.Column="1" Grid.ColumnSpan="3" Orientation="Horizontal">
                    <TextBox Width="{StaticResource XXLargeItemSize}" Text="{Binding Mode=TwoWay, Path=RemoteCertificateFile}" />
                    <Button Height="25" Content="Browse..." Command="{Binding RemoteBrowseCommand}" />
                    <CheckBox Content="Self-signed?" IsChecked="{Binding Mode=TwoWay, Path=RemoteCertificateIsSelfSigned}" />
                </StackPanel>

                <Label Grid.Row="2" Grid.Column="0" Content="Valid Policy Errors" />
                <TextBox Grid.Row="2" Grid.Column="1" Text="{Binding Mode=TwoWay, Path=ValidPolicyErrors}" />
                <Label Grid.Row="2" Grid.Column="2" Content="Valid Chain Flags" />
                <TextBox Grid.Row="2" Grid.Column="3" Text="{Binding Mode=TwoWay, Path=ValidChainFlags}" />

                <Label Grid.Row="3" Grid.Column="0" Content="Valid IP Addresses" />
                <TextBox Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="3" Width="{StaticResource XXXLargeItemSize}" Text="{Binding Mode=TwoWay, Path=ValidIPAddresses}" />
            </Grid>
        </GroupBox>
        
        <Button Content="Create..." HorizontalAlignment="Right" Margin="10" Padding="2" Command="{Binding CreateCommand}" />
    </StackPanel>
</UserControl>
